<?php
session_start();
//包含头
include '../PHP/head.php';
?>
<?php
//包含bootstrap的顶端按钮
include '../PHP/menu.php';
?>

<br />
<br />
<p class="text-center lead">已完成的任务</p>
<?php
//从task_list中搜出状态是“进行中”、“user_id”是自己的记录
require_once ('../FNS/db_fns.php');

$db = db_connect();
$query="select task_list.id as task_id, task_list.plan_date, task_list.subject, task_list.project_id, task_list.finish_date, projects.code, projects.name, projects.deadline from task_list inner join projects on task_list.project_id = projects.id where status = 'FF' and user_id = '".$user_id."' order by projects.code";
$result=$db->query ($query);
$num_result=$result->num_rows;
if (!$num_result) {
	echo "<br />";
	echo "<p>无任务。</p>";
	echo "</div>";
	echo "</body>";
	$result->free();
	$db->close();
exit;
}

//写表头
echo "<table class='table table-striped'>";
echo "<tr>";
	echo "<td align='center' class='info'><strong>报价编号</strong></td>";
	echo "<td align='center' class='info'><strong>项目名称</strong></td>";
	echo "<td align='center' class='info'><strong>安排日期</strong></td>";
	echo "<td align='center' class='info'><strong>完成日期</strong></td>";
	echo "<td align='center' class='info'><strong>报价截止日期</strong></td>";
echo "</tr>";



//循环编制表格
for ($i=0; $i < $num_result; $i++) {

	$row=$result->fetch_assoc ();
	
	$project_code = stripslashes ($row['code']);
	$project_name = stripslashes ($row['name']);
	$project_deadline = stripslashes ($row['deadline']);
	$plan_date = stripslashes ($row['plan_date']);
	$finish_date = stripslashes ($row['finish_date']);
	
	$project_id = stripslashes ($row['project_id']);
	$subject = stripslashes ($row['subject']);
	$task_id = stripslashes ($row['task_id']);
	
	
	echo "<tr>";
	echo "<td align ='center'>".$project_code."</td>";
	echo "<td align ='center'>".$project_name."</td>";
	echo "<td align ='center'>".$plan_date."</td>";
	echo "<td align ='center'>".$finish_date."</td>";
	echo "<td align ='center'>".$project_deadline."</td>";
	echo "</tr>";
	
}
echo "</table>";


$result->free();
$db->close();

?>


</div>
</body>
</html>